package cn.tedu.lucky.draw.user.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.CorsRegistry;
import org.springframework.web.reactive.config.WebFluxConfigurer;

@Configuration
public class GorGlobalConfiguration implements WebFluxConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry){
        registry.addMapping("/**") //对所有路径应用CORS配置
                .allowedOrigins("http://localhost:8080") //允许跨域访问的域名
                .allowedMethods("GET","POST","PUT","DELETE") //允许跨域访问的请求方法
                .allowedHeaders("*") //允许跨域访问的请求头
                .maxAge(3600); //预检请求的有效期(秒)
    }
}
